`top_level_1()', which handles all of the startup stuff (creating the
initial frame, handling the command-line options, loading the user's
`.emacs' file, etc.). The function that actually does this is in Lisp
and is pointed to by the variable `top-level'; normally this function is
`normal-top-level'. `top_level_1()' is just an error-handling wrapper
similar to `command_loop_2()'. Note also that `initial_command_loop()'
sets up a catch for `top-level' when invoking `top_level_1()', just
like when it invokes `command_loop_2()'.
File: internals.info, Node: Specifics of the Event Gathering Mechanism, Next: Specifics About the Emacs Event, Prev: Main Loop, Up: Events and the Event Loop
Specifics of the Event Gathering Mechanism
==========================================
Here is an approximate diagram of the collection processes at work
in XEmacs, under TTY's (TTY's are simpler than X so we'll look at this
read earlier but not processed, event_stream_next_event()
typically when waiting in a |
sit-for, sleep-for, etc. for |
a particular event to be received) |
| |
| |
V V
---->----------------------------------<------
|
| [collected in
| next_event_internal()]
|
unread- unread- event from |
command- command- keyboard else, call
events event macro next_event_internal()
| | | |
| | | |
| | | |
V V V V
--------->----------------------<------------
|
| [collected in `next-event', which may loop
| more than once if the event it gets is on
| a dead frame, device, etc.]
|
|
V
feed into top-level event loop,
which repeatedly calls `next-event'
and then dispatches the event
using `dispatch-event'
File: internals.info, Node: Specifics About the Emacs Event, Next: The Event Stream Callback Routines, Prev: Specifics of the Event Gathering Mechanism, Up: Events and the Event Loop
Specifics About the Emacs Event
===============================
File: internals.info, Node: The Event Stream Callback Routines, Next: Other Event Loop Functions, Prev: Specifics About the Emacs Event, Up: Events and the Event Loop
The Event Stream Callback Routines
==================================
File: internals.info, Node: Other Event Loop Functions, Next: Converting Events, Prev: The Event Stream Callback Routines, Up: Events and the Event Loop
Other Event Loop Functions
==========================
`detect_input_pending()' and `input-pending-p' look for input by
calling `event_stream->event_pending_p' and looking in
`[V]unread-command-event' and the `command_event_queue' (they do not
check for an executing keyboard macro, though).
`discard-input' cancels any command events pending (and any keyboard
macros currently executing), and puts the others onto the
`command_event_queue'. There is a comment about a "race condition",
which is not a good sign.
`next-command-event' and `read-char' are higher-level interfaces to
`next-event'. `next-command-event' gets the next "command" event (i.e.
keypress, mouse event, menu selection, or scrollbar action), calling
`dispatch-event' on any others. `read-char' calls `next-command-event'
and uses `event_to_character()' to return the character equivalent.
With the right kind of input method support, it is possible for
(read-char) to return a Kanji character.
File: internals.info, Node: Converting Events, Next: Dispatching Events; The Command Builder, Prev: Other Event Loop Functions, Up: Events and the Event Loop
Converting Events
=================
`character_to_event()', `event_to_character()',
`event-to-character', and `character-to-event' convert between
characters and keypress events corresponding to the characters. If the
event was not a keypress, `event_to_character()' returns -1 and
`event-to-character' returns `nil'. These functions convert between
character representation and the split-up event representation (keysym
plus mod keys).
File: internals.info, Node: Dispatching Events; The Command Builder, Prev: Converting Events, Up: Events and the Event Loop
Dispatching Events; The Command Builder
=======================================
Not yet documented.
File: internals.info, Node: Evaluation; Stack Frames; Bindings, Next: Symbols and Variables, Prev: Events and the Event Loop, Up: Top
Evaluation; Stack Frames; Bindings
**********************************
* Menu:
* Evaluation::
* Dynamic Binding; The specbinding Stack; Unwind-Protects::